-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pickers] Remove utils
and value
params from translations
#14986
[pickers] Remove utils
and value
params from translations
#14986
Conversation
Localization writing tips ✍️Seems you are updating localization 🌍 files. Thank you for contributing to the localization! 🎉 To make your PR perfect, here is a list of elements to check: ✔️
Deploy preview: https://deploy-preview-14986--material-ui-x.netlify.app/ Updated pages: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work 🙏
Can you take care of adding the migration guide (you can copy paste the doc page from #14651 and just replace the actual sections)?
Don't forget the small BC on PickersInputLocaleText
which is public 👍
No codemod required here IMHO
I also mentioned other exported types that no longer receive a parameter. |
docs/data/migration/migration-pickers-v7/migration-pickers-v7.md
Outdated
Show resolved
Hide resolved
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
docs/data/migration/migration-pickers-v7/migration-pickers-v7.md
Outdated
Show resolved
Hide resolved
docs/data/migration/migration-pickers-v7/migration-pickers-v7.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Flavien DELANGLE <flaviendelangle@gmail.com> Signed-off-by: Arthur Suh Balduini <34691066+arthurbalduini@users.noreply.github.com>
+const openDatePickerDialogue = translations.openDatePickerDialogue(value == null ? null : value.format('MM/DD/YYY')); | ||
``` | ||
|
||
Notice that `clockLabelText` expects an additional parameter with the time view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest just doing on diff per translation key.
The migration guide can be very lengthy if it helps people migrate (see this section for a very long migration content 😆 )
So something like:
The following translation key no longer receive the `utils` and the date object:
- `openDatePickerDialogue`:
```diff
// If you are setting a custom value for this translation key in a picker component or in the `LocalizationProvider`
-<DatePicker localeText={{ openDatePickerDialogue: (date, utils) => string; }} />
+<DatePicker localeText={{ openDatePickerDialogue: (formattedDate) => string; }} />
// If you using this translation key in a custom component
const translations = useTranslations();
-const openDatePickerDialogue = translations.openTimePickerDialogue(value, {} as any, value == null ? null : value.format('MM/DD/YYY'));
+const openDatePickerDialogue = translations.openDatePickerDialogue(value == null ? null : value.format('MM/DD/YYY'));
```
- `openTimePickerDialogue`:
```diff
```
ccc6bbe
to
d613f50
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you for handling it. 🙏
docs/data/migration/migration-pickers-v7/migration-pickers-v7.md
Outdated
Show resolved
Hide resolved
docs/data/migration/migration-pickers-v7/migration-pickers-v7.md
Outdated
Show resolved
Hide resolved
docs/data/migration/migration-pickers-v7/migration-pickers-v7.md
Outdated
Show resolved
Hide resolved
docs/data/migration/migration-pickers-v7/migration-pickers-v7.md
Outdated
Show resolved
Hide resolved
docs/data/migration/migration-pickers-v7/migration-pickers-v7.md
Outdated
Show resolved
Hide resolved
docs/data/migration/migration-pickers-v7/migration-pickers-v7.md
Outdated
Show resolved
Hide resolved
docs/data/migration/migration-pickers-v7/migration-pickers-v7.md
Outdated
Show resolved
Hide resolved
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for taking care of it. 🙏
docs/data/migration/migration-pickers-v7/migration-pickers-v7.md
Outdated
Show resolved
Hide resolved
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the very detailed migration guide 🙏
Changelog
Pickers
Some translation keys no longer require
utils
and the date object as parameters, but only the formatted value as a string. The keys affected by this changes are:clockLabelText
,openDatePickerDialogue
andopenTimePickerDialogue
.If you have customized those translation keys, you have to update them following the examples below:
LocalizationProvider
: